<template>
	<view class="webview-box">
		<web-view :src="webSrc"></web-view>
	</view>
</template>
<script>
	import {
		setToken,
		getToken
	} from '@/utils/token.js'
	export default {
		data() {
			return {
				webSrc: '',
			}
		},
		onLoad: function(option) {
			if (option.url) {
				this.webSrc = option.url
			}
			//console.log(this.webSrc,666)
			if (option.title) {
				if (option.title == '实名认证') {
					if (getToken('version') == 2) {
						let compInfo = getToken('complogin')
						this.webSrc =
							`https://job.ydylmold.cn/realName/index.html#/?useNum=${getToken('useNum')}&version=2&cityName=${compInfo.cityName}&token=${getToken('token')}&companyName=${compInfo.companyNameCn}`
					} else {
						let useInfo = getToken('userInfo')
						this.webSrc =
							`https://job.ydylmold.cn/realName/index.html#/?useNum=${getToken('useNum')}&version=1&token=${getToken('token')}`
					}
					uni.setNavigationBarTitle({
						title: option.title
					})
				}
				if (option.title == '提现') {
					uni.setNavigationBarTitle({
						title: option.title
					})
					this.webSrc =
						`https://job.ydylmold.cn/tiXian/index.html#/?useNum=${getToken('useNum')}&token=${getToken('token')}`
				}
				if (option.title == '轮播图') {
					this.webSrc = option.src
				}
				if (option.title == '更多新闻') {
					this.webSrc =
						`https://job.ydylmold.cn/portalNews/index.html#/?version=${getToken('version')}&useNum=${getToken('useNum')}&token=${getToken('token')}&type=2&newsCompany=null&newTypeId=null&title=更多新闻`
				}
				if (option.title == '新闻详情') {
					this.webSrc =
						`https://job.ydylmold.cn/portalNews/index.html#/pages/index/newsDetail?newsId=${option.newsId}&version=${getToken('version')}&useNum=${getToken('useNum')}&token=${getToken('token')}`
				}
				if(option.title == '用户协议'){
					this.webSrc = `https://job.ydylmold.cn/xieYi/index.html#/pages/index/index?type=app073`
				}
				if(option.title == '隐私协议'){
					this.webSrc = `https://job.ydylmold.cn/xieYi/index.html#/pages/index/index?type=app072`
				}
			}
		},
		methods: {}
	}
</script>
<style>
</style>
